package br.com.quiz.domain;

import java.io.Serializable;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.PrimaryKeyJoinColumn;

/**
 * The persistent class for the aluno database table.
 * 
 */
@Entity
@PrimaryKeyJoinColumn( name = "ALU_PES_ID" )
@NamedQueries( value = { @NamedQuery( name = "Aluno.filtrarPorId", query = "Select aluno From Aluno aluno where aluno.aluId = :aluId" ) } )
public class Aluno extends Pessoa implements Serializable{
	private static final long serialVersionUID = 1L;

	//	@Id
	@Basic
	@GeneratedValue( strategy = GenerationType.IDENTITY )
	@Column( name = "ALU_ID" )
	private int aluId;

	@Column( name = "ALU_PONTUACAO" )
	private int aluPontuacao;

	@ManyToOne
	@JoinColumn( name = "ALU_UDE_ID" )
	private UnidadedeEnsino unidadeDeEnsino;

	public Aluno(){}

	public int getAluId() {
		return this.aluId;
	}

	public void setAluId( int aluId ) {
		this.aluId = aluId;
	}

	public int getAluPontuacao() {
		return this.aluPontuacao;
	}

	public void setAluPontuacao( int aluPontuacao ) {
		this.aluPontuacao = aluPontuacao;
	}

	public UnidadedeEnsino getUnidadeDeEnsino() {
		return unidadeDeEnsino;
	}

	public void setUnidadeDeEnsino( UnidadedeEnsino unidadeDeEnsino ) {
		this.unidadeDeEnsino = unidadeDeEnsino;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}

	@Override
	public String toString() {
		return super.toString() + System.lineSeparator() + "Aluno [getAluId()=" + getAluId() + ", getAluPontuacao()=" + getAluPontuacao() + "]";
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + aluId;
		return result;
	}

	@Override
	public boolean equals( Object obj ) {
		if ( this == obj )
			return true;
		if ( obj == null )
			return false;
		if ( getClass() != obj.getClass() )
			return false;
		Aluno other = (Aluno) obj;
		if ( aluId != other.aluId )
			return false;
		return true;
	}

}